/**1 easy
 *
 */
/**
 *
 * @param {number[]} nums
 * @param {number} target
 */
function towSum(nums, target) {
  const sumMap = new Map();
  for (let i = 0; i < nums.length; i++) {
    sumMap.set(target - nums[i], i);
  }
  for (let i = 0; i < nums.length; i++) {
    if (sumMap.has(nums[i]) && sumMap.get(nums[i]) !== i) {
      return [sumMap.get(nums[i]), i];
    }
  }
}
console.log(towSum([3, 2, 4], 6));
